<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  <input type="text" id="num1">
  <input type="button" value="测验" onclick="aaa()">
 </body>
 <script>
 function aaa(){
	 var num=0;
	var a=num1.value;
	
	for(var i=2;i<=a-1;i++){
		
		if(a%i==0){
			num++
		}
	}
	if(num>=1){
	document.write(a+"不是质数"+"<br>");
	}else{
		document.write(a+"是质数"+"<br>");
	}





} 
 
 
 
 
 
 </script>
</html>
